using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using BezPanike.Domain.Services;

public partial class Default_master : System.Web.UI.MasterPage
{
    KorisniciService korisniciService = new KorisniciService();

    protected void Page_Load(object sender, EventArgs e)
    {
        linkProfil.Visible = false;
        linkAdministracija.Visible = false;

        linkPrijavaOdjava.Text = "Prijava";
        linkPrijavaOdjava.NavigateUrl = "../Login.aspx";

        if (HttpContext.Current.User != null)
        {
            if (HttpContext.Current.User.Identity.IsAuthenticated)
            {
                linkPrijavaOdjava.Text = "Odjava";
                linkPrijavaOdjava.NavigateUrl = "../Odjava.aspx";
                if (HttpContext.Current.User.Identity is FormsIdentity)
                {
                    linkProfil.Visible = true;
                    if(korisniciService.DaliJeKorisnikAdmin(HttpContext.Current.User.Identity.Name))
                    {
                        linkAdministracija.Visible = true;
                    }
                }

            }
        }
        else
        {
            linkPrijavaOdjava.Text = "Prijava";
            linkPrijavaOdjava.NavigateUrl = "../Login.aspx";
        }
    }

}